package com.tyk.bookstore.back.comment.util;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tyk.bookstore.back.comment.model.entity.CommentDo;
import com.tyk.bookstore.back.comment.model.entity.ReplyDo;
import com.tyk.bookstore.back.comment.model.query.ReplyAddQuery;
import com.tyk.bookstore.back.comment.model.vo.CommentPageVo;
import com.tyk.bookstore.back.comment.model.vo.CommentVo;
import com.tyk.bookstore.back.comment.model.vo.ReplyPageVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface MapStructComment {
    @Mappings({@Mapping(target = "children", ignore = true), @Mapping(target = "memberName", ignore = true)})
    CommentVo toCommentVo(CommentDo comment);

    List<CommentVo.Reply> toCommentVo$CommentList(List<ReplyDo> subList);

    @Mappings({@Mapping(target = "memberName", ignore = true)})
    CommentVo.Reply toCommentVo$Comment(ReplyDo subDo);

    CommentPageVo toCommentPageVo(Page<CommentDo> page);

    @Mappings({@Mapping(target = "memberName", ignore = true)})
    CommentPageVo.Comment toCommentPageVo$Comment(CommentDo commentDo);

    ReplyDo toReplyDo(ReplyAddQuery query);

    ReplyPageVo toReplyPageVo(Page<ReplyDo> page);
}
